package base;

import java.io.File;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicReference;

public class Test {
    public static void main(String[] args) {

        String path = "C:\\study\\bat\\fit_bat\\fit";
        File directory = new File(path);
        boolean isFile = directory.isFile();
        if (isFile) {
            System.out.printf("path 不是 directory");
            return;
        }

        File[] files = directory.listFiles();
        AtomicReference<String> newFileName = new AtomicReference<>("");
        String oldFileName = "";

        Arrays.asList(files).stream().forEach((x) -> {
            if (x.isDirectory()) { return; }
            newFileName.set(x.getName());
            String tempName = newFileName.get().substring(12, newFileName.get().length() - 6);

           System.out.println(tempName);
//            x.renameTo(new File(path  +"/" +  newFileName.get()));

        });

//        FileInputStream fileInputStream = new FileInputStream();

    }
}
